import Vue from "vue";
Vue.filter("handleCtx", (value, v) => {
  if (!value) return;
  return value.length > v ? value.slice(0, v) + "..." : value; // 内容过长时处理 + v;
});
Vue.filter("getAlarmLevel", function (val, that) {
  let status = "";
  switch (val) {
    case 4:
      status = that.$t("危急告警");
      break;
    case 3:
      status = that.$t("严重告警");
      break;
    case 2:
      status = that.$t("一般告警");
      break;
    case 1:
      status = that.$t("预警");
      break;
    case 0:
      status = that.$t("正常");
      break;
  }
  return status;
});
Vue.filter("gettaskType", function (val, thats) {
  let status = "";
  switch (val) {
    case 1:
      status = thats.$t("即时任务");
      break;
    case 2:
      status = thats.$t("定期任务");
      break;
    case 3:
      status = thats.$t("周期任务");
      break;
  }
  return status;
});
Vue.filter("getRecognition", function (val, that) {
  let status = "";
  switch (val) {
    case 1:
      status = that.$t("仪表识别");
      break;
    case 2:
      status = that.$t("音频分析");
      break;
    case 3:
      status = that.$t("红外测温");
      break;
    case 4:
      status = that.$t("局放检测");
      break;
    case 5:
      status = that.$t("可见光拍照");
      break;
    case 6:
      status = that.$t("热像仪录像");
      break;
    case 7:
      status = that.$t("录音");
      break;
    case 8:
      status = that.$t("热像仪录像");
      break;
    case 9:
      status = that.$t("甲烷遥测");
      break;
    case 10:
      status = that.$t("录音");
    case 11:
      status = that.$t("人员入侵检测");
    case 12:
      status = that.$t("安全帽检测");
    case 13:
      status = that.$t("三项温差");
    case 14:
      // status = that.$t("状态一致性");
      break;
  }
  return status;
});

Vue.filter("getTaskstatus", function (val) {
  let status = "";
  switch (Number(val)) {
    case 1:
      // status = "Waiting For Execution";
      status = "等待执行";
      break;
    case 2:
      // status = "Task Overdue";
      status = "任务超期";
      break;
    case 3:
      // status = "Executing";
      status = "正在执行";
      break;
    case 4:
      // status = "Stopover";
      status = "中途暂停";
      break;
    case 5:
      // status = "Execution Complete";
      status = "执行完成";
      break;
    case 6:
      status = "中途终止";
      // status = "Midway Termination";
      break;
  }
  return status;
});
// 告警类型
Vue.filter("getAlarmType", function (val, that) {
  let status = "";
  switch (val) {
    case 0:
      status = that.$t("系统告警");
      break;
    case 1:
      status = that.$t("环境告警");
      break;
    case 2:
      status = that.$t("离线告警");
      break;
    case 3:
      status = that.$t("对象告警");
      break;
    case 4:
      status = that.$t("综合告警");
      break;
  }
  return status;
});
